<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@include file="/WEB-INF/commit/head.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<div class="layui-body">
	<form class="layui-form" action="user/doupdatepwd.html">
		<div class="layui-form-item">
			<label class="layui-form-label">原密码：</label>
			<div class="layui-input-inline">
				<input type="password" id="opwd" name="oldpassword"
					lay-verify="required" autocomplete="off" class="layui-input">
			</div>
			<div id="tishi" class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">新密码：</label>
			<div class="layui-input-inline">
				<input type="password" id="npwd1" name="password"
					lay-verify="required" placeholder="请输入密码" autocomplete="off"
					class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">确认密码：</label>
			<div class="layui-input-inline">
				<input type="password" id="npwd2" name="newpassword"
					lay-verify="required" placeholder="请输入密码" autocomplete="off"
					class="layui-input">
			</div>
			<div id="checkpwd" class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button id="sub" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
$(function(){
	$("#opwd").val("");
	$("#opwd").blur(
			function() {
				$.post("user/checked.html", "oldpasswoed=" + $("#opwd").val(),
						function(check) {
							if (check == "ok") {// ok == \"ok\"
								$("#tishi").html("密码正确");
								$("#sub").attr("disabled", false);
							} else {
								$("#tishi").html("密码错误");
								$("#sub").attr("disabled", true);
							}
						})
			})

	$("#npwd2").blur(function() {
		if ($("#npwd1").val() == $("#npwd2").val()) {
			$("#checkpwd").html("密码一致");
			$("#sub").attr("disabled", false);
		} else {
			$("#checkpwd").html("两次密码不一致");
			$("#sub").attr("disabled", true);

		}

	})
})
</script>
<%@include file="/WEB-INF/commit/dibu.jsp"%>
